package com.owc.common.custom.annotation;

import com.owc.common.custom.validator.IsPhoneValidator;

import javax.validation.Constraint;
import javax.validation.Payload;
import javax.validation.ReportAsSingleViolation;
import java.lang.annotation.*;

/**
 * @Author Xiaoming
 * @Date 2019/10/22 11:05
 * @Version 1.0.0
 * @Description validation string is phone number format.
 **/
@Documented
@Target({ElementType.METHOD, ElementType.FIELD, ElementType.ANNOTATION_TYPE, ElementType.CONSTRUCTOR, ElementType.PARAMETER, ElementType.TYPE_USE})
@Retention(RetentionPolicy.RUNTIME)
@ReportAsSingleViolation
@Constraint(validatedBy = IsPhoneValidator.class)
public @interface IsPhone {

    /**
     * Default error hint message
     */
    String message() default "Illegal phone number format ";

    Class<?>[] groups() default {};

    Class<? extends Payload>[] payload() default {};
}
